package com.slz3.business.module.goodsManagement.gooBrand.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooBrand.domain.GooBrand;
import com.slz3.business.module.goodsManagement.gooBrand.domain.GooBrandFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooBrandTransactionalServiceImpl implements GooBrandTransactionalService {

    @Override
    public GooBrand modify(GooBrand gooBrandNew) {
        Repositorys.gooBrand.test();
        Repositorys.gooBrand.save(GooBrandFactory.initBaseFields());
        System.err.println(1/0);
        gooBrandNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooBrand.saveAndFlush(gooBrandNew);
    }

    @Override
    public List<GooBrand> batchModify(List<GooBrand> gooBrandList) {
        return Repositorys.gooBrand.saveAll(gooBrandList);
    }
}
